\(\int \frac {\sec (c+d x) (B \sec (c+d x)+C \sec ^2(c+d x))}{a+a \sec (c+d x)} \, dx\) [334]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 38, antiderivative size = 62 \[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {(B-C) \text {arctanh}(\sin (c+d x))}{a d}+\frac {C \tan (c+d x)}{a d}-\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))} \]

[Out]

(B-C)*arctanh(sin(d*x+c))/a/d+C*tan(d*x+c)/a/d-(B-C)*tan(d*x+c)/d/(a+a*sec(d*x+c))

Rubi [A] (verified)

Time = 0.21 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {4157, 4093, 3872, 3855, 3852, 8} \[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {(B-C) \text {arctanh}(\sin (c+d x))}{a d}-\frac {(B-C) \tan (c+d x)}{d (a \sec (c+d x)+a)}+\frac {C \tan (c+d x)}{a d} \]

[In]

Int[(Sec[c + d*x]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a*Sec[c + d*x]),x]

[Out]

((B - C)*ArcTanh[Sin[c + d*x]])/(a*d) + (C*Tan[c + d*x])/(a*d) - ((B - C)*Tan[c + d*x])/(d*(a + a*Sec[c + d*x]
))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3872

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[a, Int[(d*
Csc[e + f*x])^n, x], x] + Dist[b/d, Int[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]

Rule 4093

Int[csc[(e_.) + (f_.)*(x_)]^2*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_
)), x_Symbol] :> Simp[(-(A*b - a*B))*Cot[e + f*x]*((a + b*Csc[e + f*x])^m/(b*f*(2*m + 1))), x] + Dist[1/(b^2*(
2*m + 1)), Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^(m + 1)*Simp[A*b*m - a*B*m + b*B*(2*m + 1)*Csc[e + f*x], x],
x], x] /; FreeQ[{a, b, e, f, A, B}, x] && NeQ[A*b - a*B, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)]

Rule 4157

Int[((a_.) + csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(
x_)]^2*(C_.))*((c_.) + csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.), x_Symbol] :> Dist[1/b^2, Int[(a + b*Csc[e + f*x])
^(m + 1)*(c + d*Csc[e + f*x])^n*(b*B - a*C + b*C*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\sec ^2(c+d x) (B+C \sec (c+d x))}{a+a \sec (c+d x)} \, dx \\ & = -\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))}-\frac {\int \sec (c+d x) (-a (B-C)-a C \sec (c+d x)) \, dx}{a^2} \\ & = -\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))}+\frac {(B-C) \int \sec (c+d x) \, dx}{a}+\frac {C \int \sec ^2(c+d x) \, dx}{a} \\ & = \frac {(B-C) \text {arctanh}(\sin (c+d x))}{a d}-\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))}-\frac {C \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{a d} \\ & = \frac {(B-C) \text {arctanh}(\sin (c+d x))}{a d}+\frac {C \tan (c+d x)}{a d}-\frac {(B-C) \tan (c+d x)}{d (a+a \sec (c+d x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.51 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.76 \[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {(B-C) \text {arctanh}(\sin (c+d x))+(-B+2 C+C \sec (c+d x)) \tan \left (\frac {1}{2} (c+d x)\right )}{a d} \]

[In]

Integrate[(Sec[c + d*x]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a*Sec[c + d*x]),x]

[Out]

((B - C)*ArcTanh[Sin[c + d*x]] + (-B + 2*C + C*Sec[c + d*x])*Tan[(c + d*x)/2])/(a*d)

Maple [A] (verified)

Time = 0.18 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.50

method result size
parallelrisch \(\frac {-\cos \left (d x +c \right ) \left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\cos \left (d x +c \right ) \left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\left (\left (B -2 C \right ) \cos \left (d x +c \right )-C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d \cos \left (d x +c \right )}\) \(93\)
derivativedivides \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d a}\) \(100\)
default \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d a}\) \(100\)
norman \(\frac {-\frac {\left (B -3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}+\frac {2 \left (B -2 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a d}-\frac {\left (B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{2}}+\frac {\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}-\frac {\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a d}\) \(138\)
risch \(-\frac {2 i \left (B \,{\mathrm e}^{2 i \left (d x +c \right )}-C \,{\mathrm e}^{2 i \left (d x +c \right )}-C \,{\mathrm e}^{i \left (d x +c \right )}+B -2 C \right )}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{a d}\) \(163\)

[In]

int(sec(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

(-cos(d*x+c)*(B-C)*ln(tan(1/2*d*x+1/2*c)-1)+cos(d*x+c)*(B-C)*ln(tan(1/2*d*x+1/2*c)+1)-((B-2*C)*cos(d*x+c)-C)*t
an(1/2*d*x+1/2*c))/a/d/cos(d*x+c)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 127 vs. \(2 (62) = 124\).

Time = 0.26 (sec) , antiderivative size = 127, normalized size of antiderivative = 2.05 \[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {{\left ({\left (B - C\right )} \cos \left (d x + c\right )^{2} + {\left (B - C\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left ({\left (B - C\right )} \cos \left (d x + c\right )^{2} + {\left (B - C\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left ({\left (B - 2 \, C\right )} \cos \left (d x + c\right ) - C\right )} \sin \left (d x + c\right )}{2 \, {\left (a d \cos \left (d x + c\right )^{2} + a d \cos \left (d x + c\right )\right )}} \]

[In]

integrate(sec(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(((B - C)*cos(d*x + c)^2 + (B - C)*cos(d*x + c))*log(sin(d*x + c) + 1) - ((B - C)*cos(d*x + c)^2 + (B - C)
*cos(d*x + c))*log(-sin(d*x + c) + 1) - 2*((B - 2*C)*cos(d*x + c) - C)*sin(d*x + c))/(a*d*cos(d*x + c)^2 + a*d
*cos(d*x + c))

Sympy [F]

\[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\int \frac {B \sec ^{2}{\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx + \int \frac {C \sec ^{3}{\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx}{a} \]

[In]

integrate(sec(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)**2)/(a+a*sec(d*x+c)),x)

[Out]

(Integral(B*sec(c + d*x)**2/(sec(c + d*x) + 1), x) + Integral(C*sec(c + d*x)**3/(sec(c + d*x) + 1), x))/a

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 196 vs. \(2 (62) = 124\).

Time = 0.24 (sec) , antiderivative size = 196, normalized size of antiderivative = 3.16 \[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=-\frac {C {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {2 \, \sin \left (d x + c\right )}{{\left (a - \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - B {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{d} \]

[In]

integrate(sec(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="maxima")

[Out]

-(C*(log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a - 2*sin(d*x + c)/
((a - a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2)*(cos(d*x + c) + 1)) - sin(d*x + c)/(a*(cos(d*x + c) + 1))) - B*(l
og(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a - sin(d*x + c)/(a*(cos(
d*x + c) + 1))))/d

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.76 \[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\frac {{\left (B - C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {{\left (B - C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} - \frac {B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a} - \frac {2 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a}}{d} \]

[In]

integrate(sec(d*x+c)*(B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, algorithm="giac")

[Out]

((B - C)*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - (B - C)*log(abs(tan(1/2*d*x + 1/2*c) - 1))/a - (B*tan(1/2*d*x
+ 1/2*c) - C*tan(1/2*d*x + 1/2*c))/a - 2*C*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x + 1/2*c)^2 - 1)*a))/d

Mupad [B] (verification not implemented)

Time = 16.07 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.27 \[ \int \frac {\sec (c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {2\,C\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a-a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\right )}+\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (B-C\right )}{a\,d}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (B-C\right )}{a\,d} \]

[In]

int((B/cos(c + d*x) + C/cos(c + d*x)^2)/(cos(c + d*x)*(a + a/cos(c + d*x))),x)

[Out]

(2*C*tan(c/2 + (d*x)/2))/(d*(a - a*tan(c/2 + (d*x)/2)^2)) + (2*atanh(tan(c/2 + (d*x)/2))*(B - C))/(a*d) - (tan
(c/2 + (d*x)/2)*(B - C))/(a*d)